modelbutton: Avoid a crash
authorMatthias Clasen <mclasen@redhat.com>
Mon, 5 Apr 2021 18:06:42 +0000 (14:06 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 5 Apr 2021 18:06:42 +0000 (14:06 -0400)
We may not have a popover menu ancestor. The check for
this was forgotten in one of the branches here.

Fixes: #3831
gtk/gtkmodelbutton.c

index aa376d8945c97ed1549add3626d1f189e8e666bc..531fa25deae22fdc074f75acc847104678866e76 100644 (file)
@@ -1404,7 +1404,8 @@ pointer_cb (GObject    *object,
       GtkModelButton *button = data;
 
       stop_open (button);
-      gtk_popover_menu_set_active_item (GTK_POPOVER_MENU (popover), NULL);
+      if (popover)
+        gtk_popover_menu_set_active_item (GTK_POPOVER_MENU (popover), NULL);
     }
 }